import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

public class TestBot {
	Bot bot;

	@Before
	public void setUp() throws Exception {
		bot = new Bot(1);
	}

	@Ignore
	public void checkChangeBotNoSet() {
		List<Card> testList = new ArrayList<Card>();
		Card a = new Card("diamond", 2);
		Card b = new Card("club", 4);
		Card c = new Card("heart", 6);
		Card d = new Card("spade", 8);
		Card e = new Card("diamond", 10);

		testList.add(a);
		testList.add(b);
		testList.add(c);
		testList.add(d);

		bot.ownedCards.add(a);
		bot.ownedCards.add(b);
		bot.ownedCards.add(c);
		bot.ownedCards.add(d);
		bot.ownedCards.add(e);
		List<Card> temp = new ArrayList<>();
		temp.addAll(bot.giveCards());
		for (int i = 0; i < 4; i++)
			assertEquals(temp.get(i).getValue(), testList.get(i).getValue());

	}

	@Test
	public void checkChangeBotPoker() {
		List<Card> testList = new ArrayList<Card>();
		Card a = new Card("diamond", 10);
		Card b = new Card("diamond", 11);
		Card c = new Card("diamond", 12);
		Card d = new Card("diamond", 13);
		Card e = new Card("diamond", 14);
		testList.add(a);
		testList.add(b);
		testList.add(c);
		testList.add(d);
		testList.add(e);
		bot.ownedCards.add(a);
		bot.ownedCards.add(b);
		bot.ownedCards.add(c);
		bot.ownedCards.add(d);
		bot.ownedCards.add(e);
		 Collections.reverse(testList);
		//for (int i = 0; i < 4; i++)
			assertEquals(testList, bot.giveCards());

	}

	@Test
	public void checkChangeBotColor() {
		List<Card> testList = new ArrayList<Card>();
		Card a = new Card("diamond", 2);
		Card b = new Card("diamond", 4);
		Card c = new Card("diamond", 6);
		Card d = new Card("diamond", 8);
		Card e = new Card("diamond", 10);
		testList.add(a);
		testList.add(b);
		testList.add(c);
		testList.add(d);
		testList.add(e);
		bot.ownedCards.add(a);
		bot.ownedCards.add(b);
		bot.ownedCards.add(c);
		bot.ownedCards.add(d);
		bot.ownedCards.add(e);
		 Collections.reverse(testList);
		//for (int i = 0; i < 4; i++)
			assertEquals(testList, bot.giveCards());

	}

	@Test
	public void fourOfAKindTest() {
		List<Card> testList = new ArrayList<Card>();
		Card a = new Card("diamond", 8);
		Card b = new Card("club", 8);
		Card c = new Card("spade", 8);
		Card d = new Card("heart", 8);
		Card e = new Card("diamond", 10);
		bot.ownedCards.add(a);
		bot.ownedCards.add(b);
		bot.ownedCards.add(c);
		bot.ownedCards.add(d);
		bot.ownedCards.add(e);

		for (int i = 0; i < 4; i++)
			assertEquals(testList, bot.giveCards());
	}

	@Test
	public void fullHouseTest() {

		List<Card> testList = new ArrayList<Card>();
		Card a = new Card("diamond", 3);
		Card b = new Card("club", 2);
		Card c = new Card("heart", 2);
		Card d = new Card("diamond", 3);
		Card e = new Card("heart", 3);
		bot.ownedCards.add(a);
		bot.ownedCards.add(b);
		bot.ownedCards.add(c);
		bot.ownedCards.add(d);
		bot.ownedCards.add(e);

		for (int i = 0; i < 4; i++)
			assertEquals(testList, bot.giveCards());
	}
	
	@Test
	public void getIDTest () {
		int id = bot.getID();
		assertEquals (id, 1);
	}
	
	@Test
	public void increaseOwnedMoneyTest () {
		bot.increaseOwnedMoney(150);
		bot.increaseOwnedMoney(60);
		assertEquals (210, bot.getOwnedMoney());
	}
	
	@Test
	public void decreaseOwnedMoneyTest() {
		bot.increaseOwnedMoney(200);
		bot.decreaseOwnedMoney(50);
		assertEquals (150, bot.getOwnedMoney());
	
	}
	
	@Test
	public void checkEnoughMoneyTest () {
		bot.increaseOwnedMoney(50);
		assertEquals(false, bot.checkEnoughMoney(100));
	}
	
	@Test
	public void checkEnoughMoneyTest2 () {
		bot.increaseOwnedMoney(50);
		assertEquals (true, bot.checkEnoughMoney(10));
	}

}